package org.shop.controller.app;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.shop.entity.GoodsClassify;
import org.shop.service.GoodsClassifyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class GoodsClassifyController {
	private static Logger logger = LogManager.getLogger(GoodsClassifyController.class);
	@Autowired
    private GoodsClassifyService goodsClassifyService;
	/**
	 * 获取一级所有分类
	 * @param req
	 * @return
	 */
	@RequestMapping("app/getGoodsClassifyList")
	@ResponseBody
	public List<GoodsClassify> getGoodsClassifyList(HttpServletRequest req){
		Map<String,Object> paramMap = new HashMap<String,Object>();
		List<GoodsClassify> list = null;
		try {
			paramMap.put("parentIdIsNUll", "2");
			list = goodsClassifyService.getGoodsClassifyList(paramMap);
		}catch(Exception e){
			list = null ;
			e.printStackTrace();
			logger.error(e.getMessage());
		}
		return list;
	}
	
}
